//
//  YXMineWorkOrderViewController.m
//  CreditCard
//
//  Created by 杨旭 on 2017/12/25.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "YXMineWorkOrderViewController.h"
#import "YXMachineMaterialTableView.h"
#import "YXWorkOrderModel.h"
@interface YXMineWorkOrderViewController ()

@property (nonatomic ,strong) YXMachineMaterialTableView *tableView;
@property (nonatomic ,strong) NSArray *dataArr;
@end

@implementation YXMineWorkOrderViewController

- (YXMachineMaterialTableView *)tableView {
    if (!_tableView) {
        _tableView = [[YXMachineMaterialTableView alloc] initWithFrame:(CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64)) style:(UITableViewStylePlain)];
    }
    return _tableView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"我的工单";
    [self requestData];
    self.tableView.title = self.title;
    [self.view addSubview:self.tableView];
}

- (void)requestData {
    
    //    http://121.196.210.134:8082/mpos/wx/order_list.do
    NSString *urlStr = @"order_list.do";
    YXUserInfoModel *model = [YXUserInfoManager getUserInfo];
    NSDictionary *parameter = @{@"sessionId":model.sessionId,@"state":@"0"};
    [BX_NetWorkManager requestForPOSTWithUrl:urlStr parameter:parameter success:^(id responseObject) {
//        NSLog(@"请求成功%@",responseObject);
        if (REQUESTDATASUCCESS) {
            self.dataArr = [YXWorkOrderModel mj_objectArrayWithKeyValuesArray:responseObject[@"body"]];
            self.tableView.dataArr = self.dataArr;
            [self.tableView reloadData];
        }
    } failure:^(NSError *error) {
        NSLog(@"请求失败%@",error);
        [self showAlertWithTitle:@"提示" Messge:@"维护中，请稍等！"];
    }];
    
}


@end
